home *** CD-ROM | disk | FTP | other *** search
- Path: mail2news.demon.co.uk!genesis.demon.co.uk
- From: Lawrence Kirby <fred@genesis.demon.co.uk>
- Newsgroups: comp.lang.c
- Subject: Re: swap high and low 16 bits?
- Date: Thu, 18 Jan 96 01:18:19 GMT
- Organization: none
- Message-ID: <821927899snz@genesis.demon.co.uk>
- References: <Pine.OSF.3.91.960115174921.19742A-100000@io.UWinnipeg.ca> <ALUN.CHAMPION.96Jan16110016@g7240065.bridge.bst.bls.com> <Pine.OSF.3.91.960117143539.1414A-100000@io.UWinnipeg.ca>
- Reply-To: fred@genesis.demon.co.uk
- X-NNTP-Posting-Host: genesis.demon.co.uk
- X-Newsreader: Demon Internet Simple News v1.27
- X-Mail2News-Path: genesis.demon.co.uk
-
- In article <Pine.OSF.3.91.960117143539.1414A-100000@io.UWinnipeg.ca>
- wsimpson@uwinnipeg.ca "Bill Simpson" writes:
-
- >> The way I understand you is that you are using the result of time() as your
- >> random number.
- >No, as the seed to the RNG.
- >
- >If my program runs and terminates quickly, it will get almost exactly
- >the same seed on successive runs (differing only by low bits).
- >
- >But not if I swap high and low 16 bits.
- >
- >I have done this now and it works nicely. The seeds are far apart, even
- >for runs <1 minute apart.
-
- Just changing high order bits may not be a good idea since with some RNGs
- this won't filter down to the lower order bits. I suggest you use one
- of the expressions I posted earlier (which are incidentally simpler than
- a full swap).
-
- --
- -----------------------------------------
- Lawrence Kirby | fred@genesis.demon.co.uk
- Wilts, England | 70734.126@compuserve.com
- -----------------------------------------
-